package org.example.etl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.etl.entity.Atc;

@Mapper
public interface ATCMapper extends BaseMapper<Atc> {


    @Select(" SELECT COUNT(*) from atc_number where ACID=#{acid};")
    public boolean isExistThisAtc(String acid);

    @Update("update atc_number set PLAN_SECTOR_NAME=#{atc.getPlanSectorName()},ATC_TIME=#{atc.getAtcTime()},EXECUTE_DATE=#{atc.getExecuteDate()} where ACID=#{atc.getAcId()}; ")
    public void updateAnAtcMsg(Atc atc);

    @Insert("insert into atc_number (ACID,ATC_TIME,EXECUTE_DATE,PLAN_SECTOR_NAME) values (#{atc.getAcId()},#{atc.getAtcTime()},#{atc.getExecuteDate()},#{atc.getPlanSectorName()});")
    public void createAnAtcMsg(Atc atc);

}
